from google.appengine.ext import db

class Part(db.Model):
    part_name = db.StringProperty(required=True)

class Login(db.Model):
    email = db.StringProperty(required=True)
    date = db.DateTimeProperty(auto_now_add=True)
    
class Session(db.Model):
    rejected = db.StringProperty()
    accepted = db.StringProperty()
    diagnosis = db.StringProperty()
    diagType = db.StringProperty(required=True)
    date = db.DateTimeProperty(auto_now_add=True)

class AreaDisease(db.Model):
#    part_name = db.StringProperty(required=True)
    disease_name = db.StringProperty(required=True)
    prevention = db.StringProperty(required=True, multiline=True)
    weight = db.IntegerProperty(required=True)
    diagType = db.StringProperty(required=True)
    author = db.StringProperty()

class DiseaseSymptom(db.Model):
    disease_name = db.StringProperty(required=True)
    symptom = db.StringProperty(required=True)

class Comment(db.Model):
    author = db.StringProperty(required=True)
    email = db.StringProperty(required=True)
    content = db.StringProperty(required=True)
    date = db.DateTimeProperty(auto_now_add=True)

def createData():
    db.delete(AreaDisease.all())
    db.delete(DiseaseSymptom.all())
    AreaDisease(part_name="part1", disease_name="Maize mosaic",
                prevention="Destruct johnson grass or other hosts. Spray insecticides like monocrotophos.",
                weight=0, diagType="plants").put()

    AreaDisease(part_name="part1", disease_name="Crazy top downey mildew",
                prevention="Destroy infected plants by deep ploughing. Use resistant varieties like DMR 1. Treat seeds with metalaxyl.",
                weight=0, diagType="plants").put()
    AreaDisease(part_name="part1", disease_name="Charcoal rot",
                prevention="Irrigate regularly especially during flowering. Use resistant varieties like DHM 103. Seed treatment with carbendazim.",
                weight=0, diagType="plants").put()
    AreaDisease(part_name="part1", disease_name="Leaf blight",
                prevention="Grow resistant hybrids like DHM 103. Use protective fungicides of carbonate group.",
                weight=0, diagType="plants").put()
    AreaDisease(part_name="part1", disease_name="Slow computer",
                prevention="Install and keep Internet security software current,avoid free crap from the internet,Use Mozilla Firefox or Google Chrome as your primary Internet browser instead of Internet Explorer,Get it looked at immediately",
                weight=0, diagType="windows computers").put()
    AreaDisease(part_name="part1", disease_name="Website access biasness",
                prevention="Install and keep Internet security software current,avoid free crap from the internet,Use Mozilla Firefox or Google Chrome as your primary Internet browser instead of Internet Explorer",
                weight=0, diagType="windows computers").put()
    AreaDisease(part_name="part1", disease_name="Internet Explorer(IE) slow to load",
               prevention="Do not install Internet Explorer(IE) addons that take long to load",
               weight=0, diagType="windows computers").put()
    AreaDisease(part_name="part1", disease_name="Outlook 2003 meeting error",
               prevention="Search the file called frmcache.dat and delete this file.",
               weight=0, diagType="windows computers").put()
    AreaDisease(part_name="part1", disease_name="File-downloads caused hangs",
               prevention="As it occurs while downloading files from the internet, get to know the files being downloaded",
               weight=0, diagType="windows computers").put()
    AreaDisease(part_name="part1", disease_name="Diarrhoea",
               prevention="Takes lots of fruits and water and see a doctor immediately. Call 070707 to speak to a specialist now.",
                weight=0, diagType="human").put()
    AreaDisease(part_name="part1", disease_name="Malaria",
                prevention="Take panadol to ease headache and fever and see a doctor immediately. Call 070707 to speak to a specialist now.",
                weight=0, diagType="human").put()
    AreaDisease(part_name="part1", disease_name="Typhoid",
             prevention="Take panadol to ease headache and fever and see a doctor immediately. Call 070707 to speak to a specialist now.",
               weight=0, diagType="human").put()
    AreaDisease(part_name="part1", disease_name="Diabetes mellitus",
               prevention="Control the excessive weight of the body,The food should not contain sugar and much carbohydrates,A regulated and controlled diet is to be taken",
               weight=0, diagType="human").put()
    AreaDisease(part_name="part1", disease_name="Cancer (malignant tumour)",
               prevention="Cancer check up should be done once a year.Observe regularity in life style to keep body healthy.Avoid smoking, taking alcohol and chewing of tobacco.",
               weight=0, diagType="human").put()
    AreaDisease(part_name="part1", disease_name="Hepatitis",
               prevention="Hepatitis B vaccine.Proper hygeine is to be observed.Avoid taking fat rich substances.",
               weight=0, diagType="human").put()

    DiseaseSymptom(disease_name="Maize mosaic", symptom="fungal growth").put()
    DiseaseSymptom(disease_name="Maize mosaic", symptom="stunted growth").put()
    DiseaseSymptom(disease_name="Maize mosaic", symptom="chrolosis").put()
    DiseaseSymptom(disease_name="Crazy top downey mildew", symptom="stunted growth").put()
    DiseaseSymptom(disease_name="Crazy top downey mildew", symptom="partial or complete malformation of the tassel").put()
    DiseaseSymptom(disease_name="Crazy top downey mildew", symptom="chlorotic stripes on leaves").put()
    DiseaseSymptom(disease_name="Charcoal rot", symptom="splitting of stalk").put()
    DiseaseSymptom(disease_name="Charcoal rot", symptom="black pith on affected areas").put()
    DiseaseSymptom(disease_name="Charcoal rot", symptom="straw coloured stalk").put()
    DiseaseSymptom(disease_name="Leaf blight", symptom="chrolosis").put()
    DiseaseSymptom(disease_name="Leaf blight", symptom="a rotten stalk").put()
    DiseaseSymptom(disease_name="Leaf blight", symptom="curly leaves").put()
    DiseaseSymptom(disease_name="Slow computer", symptom="Tasks take longer time than before").put()
    DiseaseSymptom(disease_name="Website access biasness", symptom="unable to load other sites").put()
    DiseaseSymptom(disease_name="File-downloads caused hangs", symptom="The windows 7 machine hangs").put()
    DiseaseSymptom(disease_name="Outlook 2003 meeting error", symptom="Says that this meeting is not in the calendar. It may have been moved or deleted.").put()
    DiseaseSymptom(disease_name="Internet Explorer(IE) slow to load", symptom="internet connection is ok").put()
    DiseaseSymptom(disease_name="Internet Explorer(IE) slow to load", symptom="Firefox has no issues").put()
    DiseaseSymptom(disease_name="Diarrhoea", symptom="Stomachache").put()
    DiseaseSymptom(disease_name="Diarrhoea", symptom="Watery faeces").put()
    DiseaseSymptom(disease_name="Diarrhoea", symptom="Loss of appetite").put()
    DiseaseSymptom(disease_name="Diarrhoea", symptom="Nausea or vomiting").put()
    DiseaseSymptom(disease_name="Malaria", symptom="Headache").put()
    DiseaseSymptom(disease_name="Malaria", symptom="Joint pains").put()
    DiseaseSymptom(disease_name="Malaria", symptom="Fever").put()
    DiseaseSymptom(disease_name="Malaria", symptom="Flu-like symptoms").put()
    DiseaseSymptom(disease_name="Malaria", symptom="Nausea or vomiting").put()
    DiseaseSymptom(disease_name="Typhoid", symptom="Headache").put()
    DiseaseSymptom(disease_name="Typhoid", symptom="Joint pains").put()
    DiseaseSymptom(disease_name="Typhoid", symptom="Fever").put()
    DiseaseSymptom(disease_name="Typhoid", symptom="Fatigue").put()
    DiseaseSymptom(disease_name="Typhoid", symptom="Watery faeces").put()
    DiseaseSymptom(disease_name="Diabetes mellitus", symptom="More glucose in blood").put()
    DiseaseSymptom(disease_name="Diabetes mellitus", symptom="Excessive and frequent passing of urine").put()
    DiseaseSymptom(disease_name="Diabetes mellitus", symptom="Feeling thirsty and hungry frequently").put()
    DiseaseSymptom(disease_name="Diabetes mellitus", symptom="Reduced healing capacity of injury").put()
    DiseaseSymptom(disease_name="Diabetes mellitus", symptom="General weakness of the body").put()
    DiseaseSymptom(disease_name="Diabetes mellitus", symptom="coma").put()
    DiseaseSymptom(disease_name="Cancer (malignant tumour)", symptom="Persistent lump or thickening in tissues, specially in tongue, breast and uterus").put()
    DiseaseSymptom(disease_name="Cancer (malignant tumour)", symptom="Any irregular bleeding or blood-tinged discharge from any body opening").put()
    DiseaseSymptom(disease_name="Cancer (malignant tumour)", symptom="Any sore that does not heal quickly").put()
    DiseaseSymptom(disease_name="Cancer (malignant tumour)", symptom="Change in the form of mole or wart").put()
    DiseaseSymptom(disease_name="Cancer (malignant tumour)", symptom="Persistent hoarseness in voice, cough or difficulty in swallowing").put()
    DiseaseSymptom(disease_name="Hepatitis", symptom="Bodyache").put()
    DiseaseSymptom(disease_name="Hepatitis", symptom="Nausea").put()
    DiseaseSymptom(disease_name="Hepatitis", symptom="Loss of appetite").put()
    DiseaseSymptom(disease_name="Hepatitis", symptom="Eyes and skin become yellowish").put()
    DiseaseSymptom(disease_name="Hepatitis", symptom="Enlarged liver").put()
